<?php
/**
 * GioCMS
 * 
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2 
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@ninhgio.com so we can send you a copy immediately.
 * 
 * @copyright	Copyright (c) 2010-2011 GioCMS (http://cms.ninhgio.com)
 * @license		http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @author		NinhGio - ninhgio@gmail.com
 * @since		1.0
 */

class Modules_Utility_Widgets_Forecast_Widget extends Gio_Core_Widget
{
	public function showAction()
	{
		$this->view->unid = uniqid('utilityForecast_');
		$this->view->module = $this->getParam('module');
		$this->view->widget = $this->getParam('widget');
	}
	
	public function loadAction()
	{
		$cityUrl = $this->getParam('city_url');
		if (null == $cityUrl) {
			return;
		}
		$xmls = @simplexml_load_file($cityUrl, 'SimpleXMLElement', LIBXML_NOCDATA);
		$city = $xmls[0];
		$this->view->weather = $city->Weather;
		$this->view->adimg = trim($city->AdImg);
		$this->view->adimg1 = trim($city->AdImg1);
		$this->view->adimg2 = trim($city->AdImg2);
		$this->view->adimg3 = trim($city->AdImg3);
	}
	
	public function configAction()
	{
		$this->view->moduleName = Gio_Core_Widget::getIntance()->getModuleName();
		$this->view->widgetName = Gio_Core_Widget::getIntance()->getWidgetName();
		$this->view->widgetIndex = $this->getParam('widget_index');
	}
}